<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">GPS</span><span class="PUNC">=</span><span class="NAME">GPS</span><span class="PUNC">?</span><span class="NAME">GPS</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">===</span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t</span><span class="PUNC">=</span><span class="STRN">"array"</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">t</span><span class="PUNC">=</span><span class="STRN">"null"</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">uk</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">decsep</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="STRN">"Km"</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="STRN">"m"</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="STRN">"Km/h"</span><span class="PUNC">,</span><span class="NAME">time</span><span class="PUNC">:</span><span class="STRN">"h"</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="STRN">"bpm"</span><span class="PUNC">,</span><span class="NAME">labeldist</span><span class="PUNC">:</span><span class="STRN">"Dist."</span><span class="PUNC">,</span><span class="NAME">labeltime</span><span class="PUNC">:</span><span class="STRN">"Time"</span><span class="PUNC">,</span><span class="NAME">labelelev</span><span class="PUNC">:</span><span class="STRN">"Elev."</span><span class="PUNC">,</span><span class="NAME">labelvel</span><span class="PUNC">:</span><span class="STRN">"Vel."</span><span class="PUNC">,</span><span class="NAME">labelheartrate</span><span class="PUNC">:</span><span class="STRN">"H.R."</span><span class="PUNC">,</span><span class="NAME">distFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">elevFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">velFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">timeFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">heartrateFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">distDecs</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">elevDecs</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">velDecs</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">heartrateDecs</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">tagbuttonzoomfalse</span><span class="PUNC">:</span><span class="STRN">"Select and zoom"</span><span class="PUNC">,</span><span class="NAME">tagbuttonzoomtrue</span><span class="PUNC">:</span><span class="STRN">"Reset zoom"</span><span class="PUNC">,</span><span class="NAME">tagbuttonxaxisdist</span><span class="PUNC">:</span><span class="STRN">"Show time in 'X' axis"</span><span class="PUNC">,</span><span class="NAME">tagbuttonxaxishour</span><span class="PUNC">:</span><span class="STRN">"Show distance in 'X' axis"</span><span class="PUNC">,</span><span class="NAME">tagbuttonyaxiselev</span><span class="PUNC">:</span><span class="STRN">"Show velocity in 'Y' axis"</span><span class="PUNC">,</span><span class="NAME">tagbuttonyaxisvel</span><span class="PUNC">:</span><span class="STRN">"Show elevation in 'Y' axis"</span><span class="PUNC">,</span><span class="NAME">xaxistitledist</span><span class="PUNC">:</span><span class="STRN">"Distance"</span><span class="PUNC">,</span><span class="NAME">xaxistitletime</span><span class="PUNC">:</span><span class="STRN">"Time"</span><span class="PUNC">,</span><span class="NAME">yaxistitleelev</span><span class="PUNC">:</span><span class="STRN">"Elevation"</span><span class="PUNC">,</span><span class="NAME">yaxistitlevel</span><span class="PUNC">:</span><span class="STRN">"Velocity"</span><span class="PUNC">,</span><span class="NAME">yaxistitleheartrate</span><span class="PUNC">:</span><span class="STRN">"Heart Rate"</span><span class="PUNC">,</span><span class="NAME">dateTimeFormat</span><span class="PUNC">:</span><span class="STRN">"MM/dd/yyyy hh:mm:ss a"</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">es</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">decsep</span><span class="PUNC">:</span><span class="STRN">","</span><span class="PUNC">,</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="STRN">"Km"</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="STRN">"m"</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="STRN">"Km/h"</span><span class="PUNC">,</span><span class="NAME">time</span><span class="PUNC">:</span><span class="STRN">"h"</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="STRN">"ppm"</span><span class="PUNC">,</span><span class="NAME">labeldist</span><span class="PUNC">:</span><span class="STRN">"Dist."</span><span class="PUNC">,</span><span class="NAME">labeltime</span><span class="PUNC">:</span><span class="STRN">"Tiempo"</span><span class="PUNC">,</span><span class="NAME">labelelev</span><span class="PUNC">:</span><span class="STRN">"Alt."</span><span class="PUNC">,</span><span class="NAME">labelvel</span><span class="PUNC">:</span><span class="STRN">"Vel."</span><span class="PUNC">,</span><span class="NAME">labelheartrate</span><span class="PUNC">:</span><span class="STRN">"Pulso"</span><span class="PUNC">,</span><span class="NAME">distFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">elevFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">velFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">timeFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">heartrateFactor</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">distDecs</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">elevDecs</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">velDecs</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">heartrateDecs</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">tagbuttonzoomfalse</span><span class="PUNC">:</span><span class="STRN">"Seleccionar y ampliar"</span><span class="PUNC">,</span><span class="NAME">tagbuttonzoomtrue</span><span class="PUNC">:</span><span class="STRN">"Cancela ampliación"</span><span class="PUNC">,</span><span class="NAME">tagbuttonxaxisdist</span><span class="PUNC">:</span><span class="STRN">"Muestra el tiempo en el eje 'X'"</span><span class="PUNC">,</span><span class="NAME">tagbuttonxaxishour</span><span class="PUNC">:</span><span class="STRN">"Muestra la distancia en el eje 'X'"</span><span class="PUNC">,</span><span class="NAME">tagbuttonyaxiselev</span><span class="PUNC">:</span><span class="STRN">"Muestra la velocidad en el eje 'Y'"</span><span class="PUNC">,</span><span class="NAME">tagbuttonyaxisvel</span><span class="PUNC">:</span><span class="STRN">"Muestra la altitud en el eje 'Y'"</span><span class="PUNC">,</span><span class="NAME">xaxistitledist</span><span class="PUNC">:</span><span class="STRN">"Distancia"</span><span class="PUNC">,</span><span class="NAME">xaxistitletime</span><span class="PUNC">:</span><span class="STRN">"Tiempo"</span><span class="PUNC">,</span><span class="NAME">yaxistitleelev</span><span class="PUNC">:</span><span class="STRN">"Altitud"</span><span class="PUNC">,</span><span class="NAME">yaxistitlevel</span><span class="PUNC">:</span><span class="STRN">"Velocidad"</span><span class="PUNC">,</span><span class="NAME">yaxistitleheartrate</span><span class="PUNC">:</span><span class="STRN">"Pulsaciones"</span><span class="PUNC">,</span><span class="NAME">dateTimeFormat</span><span class="PUNC">:</span><span class="STRN">"dd/MM/yyyy HH:mm:ss"</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">o.uk</span><span class="PUNC">;</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">g</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.size</span><span class="PUNC">=</span><span class="NUMB">2</span><span class="PUNC">*</span><span class="NAME">s</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">val</span><span class="PUNC">:</span><span class="PUNC">-</span><span class="NUMB">10000000000</span><span class="PUNC">,</span><span class="NAME">order</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">t</span><span class="PUNC">&lt;=</span><span class="NAME">this.size</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">t</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">val</span><span class="PUNC">:</span><span class="NUMB">10000000000</span><span class="PUNC">,</span><span class="NAME">order</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">this.push</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">&lt;</span><span class="NAME">this.size</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;=</span><span class="NAME">w</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">order</span><span class="PUNC">==</span><span class="NAME">this.size</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.splice</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">val</span><span class="PUNC">:</span><span class="NUMB">10000000000</span><span class="PUNC">,</span><span class="NAME">order</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">></span><span class="NAME">y</span><span class="PUNC">&&</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">&lt;=</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">C</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">=</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">order</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">order</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">}</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">order</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">val</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">%</span><span class="NUMB">2</span><span class="PUNC">!==</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u.push</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.shift</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">u.shift</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toFixed</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">s.toFixed</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="NAME">i.decsep</span><span class="PUNC">?</span><span class="NAME">s.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="STRN">"."</span><span class="PUNC">,</span><span class="NAME">i.decsep</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">-</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">*</span><span class="NUMB">60</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">+</span><span class="STRN">":"</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">&lt;</span><span class="NUMB">10</span><span class="PUNC">?</span><span class="STRN">"0"</span><span class="PUNC">+</span><span class="NAME">t</span><span class="PUNC">:</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">h</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">=</span><span class="REGX">/(-)?(\d{4})-(\d{2})-(\d{2})(T(\d{2}):(\d{2}):(\d{2})(\.\d+)?)?(Z|(([\+-])((\d{2}):(\d{2}))))?/</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="NAME">u.replace</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="STRN">"$3/$4/$2 $6:$7:$8 GMT$12$14$15"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="NAME">t.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">1000</span><span class="PUNC">*</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Number</span><span class="PUNC">(</span><span class="NAME">u.replace</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="STRN">"0$9"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.each</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">[</span><span class="STRN">"-lon"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">[</span><span class="STRN">"-lat"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Point</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">s.elev</span><span class="PUNC">=</span><span class="NAME">u.ele</span><span class="PUNC">?</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u.ele</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">s.time</span><span class="PUNC">=</span><span class="NAME">h</span><span class="PUNC">(</span><span class="NAME">u.time</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">s.vel</span><span class="PUNC">=</span><span class="NAME">h</span><span class="PUNC">(</span><span class="NAME">u.speed</span><span class="PUNC">)</span><span class="PUNC">*</span><span class="NUMB">3.6</span><span class="PUNC">;</span><span class="NAME">s.name</span><span class="PUNC">=</span><span class="NAME">u.name</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u.desc</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s.html</span><span class="PUNC">=</span><span class="NAME">u.desc</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u.cmt</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">u.cmt</span><span class="PUNC">!=</span><span class="NAME">u.desc</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s.html</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="STRN">"&lt;br/>"</span><span class="PUNC">+</span><span class="NAME">u.cmt</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u.cmt</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s.html</span><span class="PUNC">=</span><span class="NAME">u.cmt</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">a</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">w.addTrackpoint</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w.newSegment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">x.trkpt</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">x.trkseg</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">a</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">u.addWaypoint</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="NAME">a</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">v.addRoutepoint</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.newRoute</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">w.rtept.each</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">k</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u.Position.LongitudeDegrees</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u.Position.LatitudeDegrees</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Point</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">s.elev</span><span class="PUNC">=</span><span class="NAME">u.AltitudeMeters</span><span class="PUNC">?</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u.AltitudeMeters</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">s.time</span><span class="PUNC">=</span><span class="NAME">h</span><span class="PUNC">(</span><span class="NAME">u.Time</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">s.heartrate</span><span class="PUNC">=</span><span class="NAME">u.HeartRateBpm</span><span class="PUNC">?</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">u.HeartRateBpm.Value</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">c</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">k</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">v.addTrackpoint</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.newSegment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">x.Trackpoint</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.Track</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.Activities</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.Activity</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.Lap</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.MultiSportSession</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.FirstSport</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.NextSport</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.Transition</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="REGX">/([-|+|\d]?\d*[\.[\d]+]?)[\s\t\n\r]*,[\s\t\n\r]*([-|+|\d]?\d*[\.[\d]+]?)([\s\t\n\r]*,[\s\t\n\r]*([-|+|\d]?\d*[\.[\d]+]?))?/</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">u.exec</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Point</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NUMB">4</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s.elev</span><span class="PUNC">=</span><span class="NAME">parseFloat</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NUMB">4</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">q</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w.newSegment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="REGX">/[\s\t\n\r]*,[\s\t\n\r]*/g</span><span class="PUNC">;</span><span class="NAME">A.coordinates</span><span class="PUNC">=</span><span class="NAME">A.coordinates.replace</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">,</span><span class="STRN">","</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">=</span><span class="REGX">/[\s\t\n\r]+/</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">A.coordinates.split</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">&lt;</span><span class="NAME">z.length</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">[</span><span class="NAME">B</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">e</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">[</span><span class="NAME">B</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">w.addTrackpoint</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">z.Point</span><span class="PUNC">&&</span><span class="NAME">u.wpt</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">e</span><span class="PUNC">(</span><span class="NAME">z.Point.coordinates</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">y.name</span><span class="PUNC">=</span><span class="NAME">z.name</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">y.html</span><span class="PUNC">=</span><span class="NAME">z.description</span><span class="PUNC">||</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">w.addWaypoint</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">u.trk</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">z.LineString</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">y.Placemark</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">y.Folder</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">v</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s</span><span class="PUNC">=</span><span class="NAME">s</span><span class="PUNC">||</span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"object"</span><span class="PUNC">&&</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">s</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">u</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.version</span><span class="PUNC">=</span><span class="STRN">"0.2"</span><span class="PUNC">;</span><span class="NAME">l.setI18N</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">s</span><span class="PUNC">?</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">s</span><span class="PUNC">]</span><span class="PUNC">||</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">o.uk</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Point</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.lat</span><span class="PUNC">=</span><span class="NAME">s</span><span class="PUNC">;</span><span class="NAME">this.lon</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">;</span><span class="NAME">this.lng</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">;</span><span class="NAME">this.elev</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.time</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.dist</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.dist3d</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.hour</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.vel</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.vel3d</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.heartrate</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.name</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.html</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Point.prototype</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">LatLonPoint</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">l.Data</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.trackpoints</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">this.waypoints</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">this.routepoints</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">this.numOfSegments</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.numOfTrackpoints</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.numOfWaypoints</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.numOfRoutes</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.numOfRoutepoints</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.pointAt</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">z</span><span class="PUNC">==</span><span class="STRN">"rte"</span><span class="PUNC">?</span><span class="NAME">this.routepoints</span><span class="PUNC">:</span><span class="NAME">this.trackpoints</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">-</span><span class="NAME">y</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">>=</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">-</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.newSegment</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.trackpoints.push</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.numOfSegments</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.newRoute</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.routepoints.push</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.numOfRoutes</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.indexOf</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">z</span><span class="PUNC">||</span><span class="STRN">"dist"</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">this.numOfTrackpoints</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">&lt;=</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">Math.floor</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">+</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.pointAt</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.pointAt</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">></span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.pointAt</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">&lt;</span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.getBounds</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">,</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">E</span><span class="PUNC">||</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NAME">C</span><span class="PUNC">||</span><span class="NAME">this.numOfTrackPoints</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NAME">this.pointAt</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">D.lat</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">D.lon</span><span class="PUNC">,</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">E</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">&lt;=</span><span class="NAME">C</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">D</span><span class="PUNC">=</span><span class="NAME">this.pointAt</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">D.lat</span><span class="PUNC">&lt;</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">D.lat</span><span class="PUNC">:</span><span class="NAME">x</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">D.lon</span><span class="PUNC">&lt;</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">D.lon</span><span class="PUNC">:</span><span class="NAME">y</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">D.lat</span><span class="PUNC">></span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">D.lat</span><span class="PUNC">:</span><span class="NAME">z</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">D.lon</span><span class="PUNC">></span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">D.lon</span><span class="PUNC">:</span><span class="NAME">A</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">BoundingBox</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">,</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NAME">x.distance</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">x.dist</span><span class="PUNC">=</span><span class="NAME">C.dist</span><span class="PUNC">+</span><span class="NAME">D</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">D</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.elev</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">&&</span><span class="NAME">C.elev</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">x.elev</span><span class="PUNC">-</span><span class="NAME">C.elev</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">1000</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">Math.sqrt</span><span class="PUNC">(</span><span class="NAME">Math.pow</span><span class="PUNC">(</span><span class="NAME">D</span><span class="PUNC">,</span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NAME">Math.pow</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">x.dist3d</span><span class="PUNC">=</span><span class="NAME">C.dist3d</span><span class="PUNC">+</span><span class="NAME">E</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.time</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">&&</span><span class="NAME">C.time</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">x.time</span><span class="PUNC">-</span><span class="NAME">C.time</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">3600000</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">!==</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">D</span><span class="PUNC">/</span><span class="NAME">B</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">E</span><span class="PUNC">/</span><span class="NAME">B</span><span class="PUNC">}</span><span class="NAME">x.vel</span><span class="PUNC">=</span><span class="NAME">x.vel</span><span class="PUNC">||</span><span class="NAME">z</span><span class="PUNC">;</span><span class="NAME">x.hour</span><span class="PUNC">=</span><span class="NAME">C.hour</span><span class="PUNC">+</span><span class="NAME">B</span><span class="PUNC">;</span><span class="NAME">x.vel3d</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">y.dist</span><span class="PUNC">=</span><span class="NAME">x.dist</span><span class="PUNC">;</span><span class="NAME">y.dist3d</span><span class="PUNC">=</span><span class="NAME">x.dist3d</span><span class="PUNC">;</span><span class="NAME">y.hour</span><span class="PUNC">=</span><span class="NAME">x.hour</span><span class="PUNC">;</span><span class="NAME">y.elev</span><span class="PUNC">=</span><span class="NAME">x.elev</span><span class="PUNC">;</span><span class="NAME">y.vel</span><span class="PUNC">=</span><span class="NAME">x.vel</span><span class="PUNC">;</span><span class="NAME">y.vel3d</span><span class="PUNC">=</span><span class="NAME">x.vel3d</span><span class="PUNC">;</span><span class="NAME">y.heartrate</span><span class="PUNC">=</span><span class="NAME">x.heartrate</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">Number.MAX_VALUE</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">&lt;</span><span class="NAME">w.numOfTrackpoints</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">x.distance</span><span class="PUNC">(</span><span class="NAME">w.pointAt</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">&lt;</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">w.pointAt</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">B</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">&lt;=</span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">A</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="NAME">this.addTrackpoint</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.numOfSegments</span><span class="PUNC">===</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.newSegment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.trackpoints</span><span class="PUNC">[</span><span class="NAME">this.numOfSegments</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.numOfTrackpoints</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.addWaypoint</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.waypoints.push</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.numOfWaypoints</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.addRoutepoint</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.numOfRoutes</span><span class="PUNC">===</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.newRoute</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.routepoints</span><span class="PUNC">[</span><span class="NAME">this.numOfRoutes</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.numOfRoutepoints</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.adjustWayPointsToTrack</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">&lt;</span><span class="NAME">this.numOfWaypoints</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">this.waypoints</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u</span><span class="PUNC">(</span><span class="NAME">this.waypoints</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">this.waypoints</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">dist</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.waypoints</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">dist3d</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.waypoints</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">hour</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.adjustRoutePointsToTrack</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">&lt;</span><span class="NAME">this.numOfRoutes</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">&lt;</span><span class="NAME">this.routepoints</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">(</span><span class="NAME">this.routepoints</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u</span><span class="PUNC">(</span><span class="NAME">this.routepoints</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Summary</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.data</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">filterRadius</span><span class="PUNC">:</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">stoppedDist</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">/</span><span class="NUMB">1000</span><span class="PUNC">,</span><span class="NAME">stoppedVel</span><span class="PUNC">:</span><span class="NUMB">0.5</span><span class="PUNC">,</span><span class="NAME">minSlope</span><span class="PUNC">:</span><span class="NUMB">0.05</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.reset</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.totDist</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.totDist3d</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">this.minElev</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.maxElev</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.elevGain</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.elevLoss</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.minHeartrate</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.maxHeartrate</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.avgHeartrate</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.maxVel</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.avgVel</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTime</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTimeStop</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTimeUp</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTimeDown</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTimeFlat</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.totTimeMove</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.calculate</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">L</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">this.options.source</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">G</span><span class="PUNC">=</span><span class="NAME">this.options.filterRadius</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.data.numOfTrackpoints</span><span class="PUNC">&lt;</span><span class="NAME">G</span><span class="PUNC">)</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">!=</span><span class="STRN">"rte"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">g</span><span class="PUNC">(</span><span class="NAME">G</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.reset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">L</span><span class="PUNC">=</span><span class="NAME">L</span><span class="PUNC">||</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">===</span><span class="NAME">undefined</span><span class="PUNC">?</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">==</span><span class="STRN">"rte"</span><span class="PUNC">?</span><span class="NAME">this.data.numOfRoutepoints</span><span class="PUNC">:</span><span class="NAME">this.data.numOfTrackpoints</span><span class="PUNC">)</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">K</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">this.data.pointAt</span><span class="PUNC">(</span><span class="NAME">L</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="NAME">x.elev</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">M</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">!=</span><span class="STRN">"rte"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">M</span><span class="PUNC">&lt;=</span><span class="NAME">G</span><span class="PUNC">;</span><span class="NAME">M</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">D.push</span><span class="PUNC">(</span><span class="NAME">this.data.pointAt</span><span class="PUNC">(</span><span class="NAME">L</span><span class="PUNC">+</span><span class="NAME">M</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">elev</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">D.shift</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">=</span><span class="NAME">L</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">M</span><span class="PUNC">&lt;=</span><span class="NAME">v</span><span class="PUNC">;</span><span class="NAME">M</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">this.data.pointAt</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">J.dist</span><span class="PUNC">-</span><span class="NAME">x.dist</span><span class="PUNC">;</span><span class="NAME">this.totDist</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">A</span><span class="PUNC">;</span><span class="NAME">this.totDist3d</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">J.dist3d</span><span class="PUNC">-</span><span class="NAME">x.dist3d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">J.elev</span><span class="PUNC">||</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J.elev</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">&lt;</span><span class="NAME">v</span><span class="PUNC">-</span><span class="NAME">G</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">!=</span><span class="STRN">"rte"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">D.push</span><span class="PUNC">(</span><span class="NAME">this.data.pointAt</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">+</span><span class="NAME">G</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">elev</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">D.shift</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.maxElev</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">H</span><span class="PUNC">></span><span class="NAME">this.maxElev</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.maxElev</span><span class="PUNC">=</span><span class="NAME">H</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.minElev</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">H</span><span class="PUNC">&lt;</span><span class="NAME">this.minElev</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.minElev</span><span class="PUNC">=</span><span class="NAME">H</span><span class="PUNC">}</span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">H</span><span class="PUNC">-</span><span class="NAME">u</span><span class="PUNC">;</span><span class="NAME">this.elevGain</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">B</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.elevLoss</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">&lt;</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">B</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J.time</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.totTime</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">J.hour</span><span class="PUNC">-</span><span class="NAME">x.hour</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">=</span><span class="NAME">J.hour</span><span class="PUNC">-</span><span class="NAME">x.hour</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">J.dist3d</span><span class="PUNC">-</span><span class="NAME">x.dist3d</span><span class="PUNC">&lt;</span><span class="NAME">this.options.stoppedDist</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">w</span><span class="PUNC">=</span><span class="NAME">w</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">J.vel3d</span><span class="PUNC">&lt;</span><span class="NAME">this.options.stoppedVel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.totTimeStop</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">this.totTimeMove</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NAME">Math.abs</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">/</span><span class="NAME">A</span><span class="PUNC">/</span><span class="NUMB">1000</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">/</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">J.dist</span><span class="PUNC">-</span><span class="NAME">x.dist</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">&lt;</span><span class="NAME">this.options.minSlope</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">B</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.totTimeUp</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">&lt;</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.totTimeDown</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">this.totTimeFlat</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J.vel</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">I</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">J.vel</span><span class="PUNC">;</span><span class="NAME">K</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.maxVel</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">J.vel</span><span class="PUNC">></span><span class="NAME">this.maxVel</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.maxVel</span><span class="PUNC">=</span><span class="NAME">J.vel</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J.heartrate</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">y</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">J.heartrate</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.maxHeartrate</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">J.heartrate</span><span class="PUNC">></span><span class="NAME">this.maxHeartrate</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.maxHeartrate</span><span class="PUNC">=</span><span class="NAME">J.heartrate</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">this.minHeartrate</span><span class="PUNC">===</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">J.heartrate</span><span class="PUNC">&lt;</span><span class="NAME">this.minHeartrate</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.minHeartrate</span><span class="PUNC">=</span><span class="NAME">J.heartrate</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">J</span><span class="PUNC">;</span><span class="NAME">u</span><span class="PUNC">=</span><span class="NAME">H</span><span class="PUNC">}</span><span class="NAME">this.avgVel</span><span class="PUNC">=</span><span class="NAME">K</span><span class="PUNC">?</span><span class="NAME">I</span><span class="PUNC">/</span><span class="NAME">K</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">this.avgHeartrate</span><span class="PUNC">=</span><span class="NAME">E</span><span class="PUNC">?</span><span class="NAME">y</span><span class="PUNC">/</span><span class="NAME">E</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.options.source</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">t.numOfTrackpoints</span><span class="PUNC">==</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">t.numOfRoutepoints</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="STRN">"rte"</span><span class="PUNC">:</span><span class="STRN">"trk"</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Parser</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.url</span><span class="PUNC">=</span><span class="NAME">s</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">method</span><span class="PUNC">:</span><span class="STRN">"post"</span><span class="PUNC">,</span><span class="NAME">trk</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">wpt</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">rte</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">adjustPoints</span><span class="PUNC">:</span><span class="NUMB">0.05</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.run</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Ajax.Request</span><span class="PUNC">(</span><span class="NAME">this.url</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">method</span><span class="PUNC">:</span><span class="NAME">v.options.method</span><span class="PUNC">,</span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XML.ObjTree</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">z.parseXML</span><span class="PUNC">(</span><span class="NAME">y.responseText</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.parsererror</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">alert</span><span class="PUNC">(</span><span class="NAME">x.parsererror</span><span class="PUNC">[</span><span class="STRN">"#text"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.gpx</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.trk</span><span class="PUNC">&&</span><span class="NAME">x.gpx.trk</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">b</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.gpx.trk</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.wpt</span><span class="PUNC">&&</span><span class="NAME">x.gpx.wpt</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">p</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.gpx.wpt</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.rte</span><span class="PUNC">&&</span><span class="NAME">x.gpx.rte</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">n</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.gpx.rte</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.kml</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">q</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.kml.Document</span><span class="PUNC">?</span><span class="NAME">x.kml.Document</span><span class="PUNC">:</span><span class="NAME">x.kml</span><span class="PUNC">,</span><span class="NAME">v.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.TrainingCenterDatabase</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.trk</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">c</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">x.TrainingCenterDatabase</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.adjustPoints</span><span class="PUNC">&&</span><span class="NAME">v.options.trk</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.wpt</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u.adjustWayPointsToTrack</span><span class="PUNC">(</span><span class="NAME">v.options.adjustPoints</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">v.options.rte</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u.adjustRoutePointsToTrack</span><span class="PUNC">(</span><span class="NAME">v.options.adjustPoints</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">document.observe</span><span class="PUNC">(</span><span class="STRN">"dom:loaded"</span><span class="PUNC">,</span><span class="NAME">w</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">onException</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">"Exception "</span><span class="PUNC">+</span><span class="NAME">x.name</span><span class="PUNC">+</span><span class="STRN">": "</span><span class="PUNC">+</span><span class="NAME">x.message</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Data</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Map</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.map</span><span class="PUNC">=</span><span class="NAME">w</span><span class="PUNC">;</span><span class="NAME">this.gpsData</span><span class="PUNC">=</span><span class="NAME">v</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">trk</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">width</span><span class="PUNC">:</span><span class="NUMB">3</span><span class="PUNC">,</span><span class="NAME">color</span><span class="PUNC">:</span><span class="STRN">"#ff0000"</span><span class="PUNC">,</span><span class="NAME">opacity</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">rte</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">width</span><span class="PUNC">:</span><span class="NUMB">3</span><span class="PUNC">,</span><span class="NAME">color</span><span class="PUNC">:</span><span class="STRN">"#00ff00"</span><span class="PUNC">,</span><span class="NAME">opacity</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">wpt</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">marker</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">icon</span><span class="PUNC">:</span><span class="STRN">"img/icon52.png"</span><span class="PUNC">,</span><span class="NAME">iconSize</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="NUMB">32</span><span class="PUNC">,</span><span class="NUMB">32</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">iconAnchor</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="NUMB">16</span><span class="PUNC">,</span><span class="NUMB">16</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">iconShadow</span><span class="PUNC">:</span><span class="STRN">"img/void.png"</span><span class="PUNC">,</span><span class="NAME">iconShadowSize</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="NUMB">32</span><span class="PUNC">,</span><span class="NUMB">32</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">join</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">info</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">chart</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">followMarker</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">=</span><span class="NAME">Object.clone</span><span class="PUNC">(</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">F</span><span class="PUNC">,</span><span class="NAME">B</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.trk</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.join</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;</span><span class="NAME">this.gpsData.numOfSegments</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">&lt;</span><span class="NAME">this.gpsData.trackpoints</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">this.gpsData.trackpoints</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">this.gpsData.trackpoints</span><span class="PUNC">}</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;</span><span class="NAME">E.length</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">C</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Polyline</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.map.addPolylineWithData</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">,</span><span class="NAME">F.trk</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">E</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.rte</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.join</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;</span><span class="NAME">this.gpsData.numOfRoutes</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">&lt;</span><span class="NAME">this.gpsData.routepoints</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">push</span><span class="PUNC">(</span><span class="NAME">this.gpsData.routepoints</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">this.gpsData.routepoints</span><span class="PUNC">}</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;</span><span class="NAME">E.length</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">C</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Polyline</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.map.addPolylineWithData</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">,</span><span class="NAME">F.rte</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.wpt</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">&lt;</span><span class="NAME">this.gpsData.numOfWaypoints</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NAME">this.gpsData.waypoints</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Marker</span><span class="PUNC">(</span><span class="NAME">D</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">D.name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">y.setLabel</span><span class="PUNC">(</span><span class="NAME">D.name</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">D.html</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">F.info</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">y.setInfoDiv</span><span class="PUNC">(</span><span class="NAME">D.html</span><span class="PUNC">,</span><span class="NAME">F.info</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">F.info</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">y.setInfoBubble</span><span class="PUNC">(</span><span class="NAME">D.html</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">this.map.addMarkerWithData</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">F.wpt</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">this.map.autoCenterAndZoom</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">this.options.chart</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.container.observe</span><span class="PUNC">(</span><span class="STRN">"flotr:mousemove"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">A.memo</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">x.gpsData.indexOf</span><span class="PUNC">(</span><span class="NAME">y.x</span><span class="PUNC">,</span><span class="NAME">x.options.chart.options.x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x.map.removeMarker</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Marker</span><span class="PUNC">(</span><span class="NAME">x.gpsData.pointAt</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">x.map.addMarkerWithData</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">x.options.marker</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.options.followMarker</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">x.map.api</span><span class="PUNC">==</span><span class="STRN">"google"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x.map.getMap</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">panTo</span><span class="PUNC">(</span><span class="NAME">s.location.toGoogle</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">x.map.setCenter</span><span class="PUNC">(</span><span class="NAME">s.location</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.container.observe</span><span class="PUNC">(</span><span class="STRN">"flotr:select"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">y.memo</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">v.indexOf</span><span class="PUNC">(</span><span class="NAME">B.x1</span><span class="PUNC">,</span><span class="NAME">x.options.chart.options.x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">v.indexOf</span><span class="PUNC">(</span><span class="NAME">B.x2</span><span class="PUNC">,</span><span class="NAME">x.options.chart.options.x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">x.map.setBounds</span><span class="PUNC">(</span><span class="NAME">v.getBounds</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.container.observe</span><span class="PUNC">(</span><span class="STRN">"tools4gps:mapautozoom"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">x.map.autoCenterAndZoom</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Profile</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">D</span><span class="PUNC">,</span><span class="NAME">t</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container</span><span class="PUNC">=</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">D</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.gpsData</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">x</span><span class="PUNC">:</span><span class="STRN">"dist"</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">:</span><span class="STRN">"elev"</span><span class="PUNC">,</span><span class="NAME">colors</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">"#4da74d"</span><span class="PUNC">,</span><span class="STRN">"#00A8F0"</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">join</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">trackingEnabled</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">zoomEnabled</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">xDecs</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">yDecs</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">xFactor</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">yFactor</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">xUnit</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">yUnit</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">xaxis</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">yaxis</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">HtmlText</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">trk</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">wpt</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">rte</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">mouse</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">track</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">lineColor</span><span class="PUNC">:</span><span class="STRN">"purple"</span><span class="PUNC">,</span><span class="NAME">trackFormatter</span><span class="PUNC">:</span><span class="NAME">G</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">selection</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">mode</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">,</span><span class="NAME">H</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">H</span><span class="PUNC">||</span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">,</span><span class="NAME">J</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">J.xaxis.tickFormatter</span><span class="PUNC">=</span><span class="NAME">J.xaxis.tickFormatter</span><span class="PUNC">||</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="NAME">z.options.x</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">?</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">z.options.xUnit</span><span class="PUNC">||</span><span class="NAME">A</span><span class="PUNC">[</span><span class="NAME">z.options.x</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">J.yaxis.tickFormatter</span><span class="PUNC">=</span><span class="NAME">J.yaxis.tickFormatter</span><span class="PUNC">||</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="NAME">z.options.y</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">?</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">z.options.yUnit</span><span class="PUNC">||</span><span class="NAME">A</span><span class="PUNC">[</span><span class="NAME">z.options.y</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">J.xaxis.title</span><span class="PUNC">=</span><span class="NAME">z.options.x</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">?</span><span class="NAME">i.xaxistitletime</span><span class="PUNC">:</span><span class="NAME">i.xaxistitledist</span><span class="PUNC">;</span><span class="NAME">J.yaxis.title</span><span class="PUNC">=</span><span class="NAME">z.options.y</span><span class="PUNC">==</span><span class="STRN">"elev"</span><span class="PUNC">?</span><span class="NAME">i.yaxistitleelev</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="NAME">z.options.y</span><span class="PUNC">==</span><span class="STRN">"heartrate"</span><span class="PUNC">?</span><span class="NAME">i.yaxistitleheartrate</span><span class="PUNC">:</span><span class="NAME">i.yaxistitlevel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">J.xDecs</span><span class="PUNC">=</span><span class="NAME">J.xDecs</span><span class="PUNC">||</span><span class="NAME">u</span><span class="PUNC">[</span><span class="NAME">J.x</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">J.yDecs</span><span class="PUNC">=</span><span class="NAME">J.yDecs</span><span class="PUNC">||</span><span class="NAME">u</span><span class="PUNC">[</span><span class="NAME">J.y</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">J.xFactor</span><span class="PUNC">=</span><span class="NAME">J.xFactor</span><span class="PUNC">||</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">J.x</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">J.yFactor</span><span class="PUNC">=</span><span class="NAME">J.yFactor</span><span class="PUNC">||</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">J.y</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">J.minDeltaX</span><span class="PUNC">=</span><span class="NAME">J.minDeltaX</span><span class="PUNC">||</span><span class="NAME">E</span><span class="PUNC">[</span><span class="NAME">J.x</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">J.mouse.track</span><span class="PUNC">=</span><span class="NAME">J.trackingEnabled</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J.zoomEnabled</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">J.selection.mode</span><span class="PUNC">=</span><span class="STRN">"xy"</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">J.selection.mode</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">J.xaxis</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">J.yaxis</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.container.fire</span><span class="PUNC">(</span><span class="STRN">"tools4gps:mapautozoom"</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">G</span><span class="PUNC">(</span><span class="NAME">H</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">[</span><span class="NAME">z.options.x</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">" = "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">z.options.x</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">?</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">H.x</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">H.x</span><span class="PUNC">,</span><span class="NAME">z.options.xDecs</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">" "</span><span class="PUNC">+</span><span class="NAME">x</span><span class="PUNC">[</span><span class="NAME">z.options.y</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">" = "</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">z.options.y</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">?</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">H.y</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">H.y</span><span class="PUNC">,</span><span class="NAME">z.options.yDecs</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">z.options.xaxis</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">z.options.yaxis</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">z.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">z.container.fire</span><span class="PUNC">(</span><span class="STRN">"tools4gps:mapautozoom"</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">K</span><span class="PUNC">=</span><span class="NAME">z.options</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">I.memo</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">z.options.x</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">L</span><span class="PUNC">=</span><span class="NAME">z.options.y</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">K.xaxis</span><span class="PUNC">,</span><span class="PUNC">(</span><span class="NAME">J.x2</span><span class="PUNC">-</span><span class="NAME">J.x1</span><span class="PUNC">></span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">H</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="NAME">J.x1</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="NAME">J.x2</span><span class="PUNC">}</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="NAME">J.x1</span><span class="PUNC">+</span><span class="NAME">J.x2</span><span class="PUNC">-</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">H</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="NAME">J.x1</span><span class="PUNC">+</span><span class="NAME">J.x2</span><span class="PUNC">+</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">H</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">Object.extend</span><span class="PUNC">(</span><span class="NAME">K.yaxis</span><span class="PUNC">,</span><span class="PUNC">(</span><span class="NAME">J.y2</span><span class="PUNC">-</span><span class="NAME">J.y1</span><span class="PUNC">></span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="NAME">J.y1</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="NAME">J.y2</span><span class="PUNC">}</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">min</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="NAME">J.y1</span><span class="PUNC">+</span><span class="NAME">J.y2</span><span class="PUNC">-</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">,</span><span class="NAME">max</span><span class="PUNC">:</span><span class="PUNC">(</span><span class="NAME">J.y1</span><span class="PUNC">+</span><span class="NAME">J.y2</span><span class="PUNC">+</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">z.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">(</span><span class="NAME">O</span><span class="PUNC">,</span><span class="NAME">N</span><span class="PUNC">,</span><span class="NAME">M</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">K</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">N.x.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"dist"</span><span class="PUNC">?</span><span class="NAME">N.colors</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">N.colors</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">data</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">color</span><span class="PUNC">:</span><span class="NAME">K</span><span class="PUNC">,</span><span class="NAME">lines</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">show</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">,</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">L</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">L</span><span class="PUNC">&lt;</span><span class="NAME">O.length</span><span class="PUNC">;</span><span class="NAME">L</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">J</span><span class="PUNC">&lt;</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">J</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">L</span><span class="PUNC">+</span><span class="NAME">J</span><span class="PUNC">===</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">J</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">N.x</span><span class="PUNC">]</span><span class="PUNC">-</span><span class="NAME">H</span><span class="PUNC">[</span><span class="NAME">N.x</span><span class="PUNC">]</span><span class="PUNC">></span><span class="NAME">N.minDeltaX</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">I.data.push</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">J</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">N.x</span><span class="PUNC">]</span><span class="PUNC">*</span><span class="NAME">N.xFactor</span><span class="PUNC">,</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">J</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">N.y</span><span class="PUNC">]</span><span class="PUNC">*</span><span class="NAME">N.yFactor</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">L</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">J</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">N.join</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">=</span><span class="NAME">Object.clone</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">I.data</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">N.join</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">this.loadData</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">K</span><span class="PUNC">=</span><span class="NAME">z.options</span><span class="PUNC">;</span><span class="NAME">v</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">K.trk</span><span class="PUNC">&&</span><span class="NAME">this.gpsData.numOfTrackpoints</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w</span><span class="PUNC">(</span><span class="NAME">this.gpsData.trackpoints</span><span class="PUNC">,</span><span class="NAME">K</span><span class="PUNC">,</span><span class="NAME">K.trk</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">K.rte</span><span class="PUNC">&&</span><span class="NAME">this.gpsData.numOfRoutes</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w</span><span class="PUNC">(</span><span class="NAME">this.gpsData.routepoints</span><span class="PUNC">,</span><span class="NAME">K</span><span class="PUNC">,</span><span class="NAME">K.rte</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">K.wpt</span><span class="PUNC">&&</span><span class="NAME">this.gpsData.numOfWaypoints</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">K.x.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">4</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"dist"</span><span class="PUNC">?</span><span class="NAME">K.colors</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">K.colors</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">L</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">data</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">color</span><span class="PUNC">:</span><span class="NAME">H</span><span class="PUNC">,</span><span class="NAME">points</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">show</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">fillColor</span><span class="PUNC">:</span><span class="NAME">H</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">K.wpt</span><span class="PUNC">,</span><span class="NAME">L</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">this.gpsData.waypoints</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">&lt;</span><span class="NAME">J.length</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">K.x</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">L.data.push</span><span class="PUNC">(</span><span class="PUNC">[</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">K.x</span><span class="PUNC">]</span><span class="PUNC">*</span><span class="NAME">K.xFactor</span><span class="PUNC">,</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">K.y</span><span class="PUNC">]</span><span class="PUNC">*</span><span class="NAME">K.yFactor</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">v.push</span><span class="PUNC">(</span><span class="NAME">L</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">H</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="NAME">Object.clone</span><span class="PUNC">(</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">H</span><span class="PUNC">,</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">I.wpt</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">I.trk</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">I.rte</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="NAME">Flotr.draw</span><span class="PUNC">(</span><span class="NAME">this.container</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.dist</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.dist</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NAME">i.time</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.elev</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.vel</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NAME">i.vel</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrate</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.labeldist</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.labeldist</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NAME">i.labeltime</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.labelelev</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.labelvel</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NAME">i.labelvel</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NAME">i.labelheartrate</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NAME">i.timeFactor</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">vel3dFactor</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">heartrateFactor</span><span class="PUNC">:</span><span class="NAME">i.heartrateFactor</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NUMB">0.02</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NUMB">0.02</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NUMB">20</span><span class="PUNC">/</span><span class="NUMB">3600</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NUMB">0</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NUMB">0.1</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NUMB">0.1</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NUMB">0.1</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NUMB">10</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.container.observe</span><span class="PUNC">(</span><span class="STRN">"flotr:select"</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.container.observe</span><span class="PUNC">(</span><span class="STRN">"dblclick"</span><span class="PUNC">,</span><span class="NAME">F</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.loadData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Report</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container</span><span class="PUNC">=</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">decimals</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">totDist</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">totDist3d</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">maxElev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">minElev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">elevGain</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">elevLoss</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">avgVel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">maxVel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">maxHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">,</span><span class="NAME">minHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">,</span><span class="NAME">avgHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">factors</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">totDist</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">totDist3d</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">maxElev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">minElev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">elevGain</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">elevLoss</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">avgVel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">maxVel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">maxHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateFactor</span><span class="PUNC">,</span><span class="NAME">minHeartrate</span><span class="PUNC">:</span><span class="NAME">i.hearthrateFactor</span><span class="PUNC">,</span><span class="NAME">avgHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateFactor</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">chart</span><span class="PUNC">:</span><span class="KEYW">false</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.summary</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Summary</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.summary.setOptions</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">,</span><span class="NAME">D</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NAME">this.summary</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">this.options.decimals</span><span class="PUNC">;</span><span class="NAME">C.calculate</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">,</span><span class="NAME">D</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">this.container.getElementsByClassName</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">&lt;</span><span class="NAME">B.length</span><span class="PUNC">;</span><span class="NAME">z</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">this.options.factors</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">*</span><span class="NAME">this.options.factors</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">C</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">y</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">A.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">7</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"totTime"</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">[</span><span class="NAME">A</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">=</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">||</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="PUNC">=</span><span class="NAME">y</span><span class="PUNC">+</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">z</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">this.options.chart</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.container.observe</span><span class="PUNC">(</span><span class="STRN">"flotr:select"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">x.memo</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">v.indexOf</span><span class="PUNC">(</span><span class="NAME">A.x1</span><span class="PUNC">,</span><span class="NAME">w.options.chart.options.x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">v.indexOf</span><span class="PUNC">(</span><span class="NAME">A.x2</span><span class="PUNC">,</span><span class="NAME">w.options.chart.options.x</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">w.draw</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">,</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Planner</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container</span><span class="PUNC">=</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">decimals</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">lat</span><span class="PUNC">:</span><span class="NUMB">6</span><span class="PUNC">,</span><span class="NAME">lon</span><span class="PUNC">:</span><span class="NUMB">6</span><span class="PUNC">,</span><span class="NAME">lng</span><span class="PUNC">:</span><span class="NUMB">6</span><span class="PUNC">,</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">heartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">,</span><span class="NAME">totDist</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">totDist3d</span><span class="PUNC">:</span><span class="NAME">i.distDecs</span><span class="PUNC">,</span><span class="NAME">maxElev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">minElev</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">elevGain</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">elevLoss</span><span class="PUNC">:</span><span class="NAME">i.elevDecs</span><span class="PUNC">,</span><span class="NAME">avgVel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">maxVel</span><span class="PUNC">:</span><span class="NAME">i.velDecs</span><span class="PUNC">,</span><span class="NAME">maxHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">,</span><span class="NAME">minHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">,</span><span class="NAME">avgHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateDecs</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">factors</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">dist</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">dist3d</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">hour</span><span class="PUNC">:</span><span class="NAME">i.timeFactor</span><span class="PUNC">,</span><span class="NAME">elev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">vel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">vel3d</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">totDist</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">totDist3d</span><span class="PUNC">:</span><span class="NAME">i.distFactor</span><span class="PUNC">,</span><span class="NAME">maxElev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">minElev</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">elevGain</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">elevLoss</span><span class="PUNC">:</span><span class="NAME">i.elevFactor</span><span class="PUNC">,</span><span class="NAME">avgVel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">maxVel</span><span class="PUNC">:</span><span class="NAME">i.velFactor</span><span class="PUNC">,</span><span class="NAME">maxHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateFactor</span><span class="PUNC">,</span><span class="NAME">minHeartrate</span><span class="PUNC">:</span><span class="NAME">i.hearthrateFactor</span><span class="PUNC">,</span><span class="NAME">avgHeartrate</span><span class="PUNC">:</span><span class="NAME">i.heartrateFactor</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">:</span><span class="STRN">"wpt"</span><span class="PUNC">,</span><span class="NAME">sourceRef</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">includeStart</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="NAME">includeEnd</span><span class="PUNC">:</span><span class="KEYW">true</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.loadData</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">u</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">this.options.sourceRef</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">G</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">F</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">Object.isArray</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">F</span><span class="PUNC">=</span><span class="NAME">A</span><span class="PUNC">[</span><span class="NAME">E</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">F</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="NAME">A</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">C.includeStart</span><span class="PUNC">||</span><span class="PUNC">(</span><span class="NAME">C.includeStart</span><span class="PUNC">&&</span><span class="NAME">A</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">==</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">H</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C.source.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"R"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">Number.MAX_VALUE</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">&lt;</span><span class="NAME">x.numOfRoutes</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">G</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">G</span><span class="PUNC">&lt;</span><span class="NAME">x.routepoints</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="NAME">G</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">D</span><span class="PUNC">==</span><span class="NAME">F</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">x.routepoints</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">G</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">D</span><span class="PUNC">;</span><span class="NAME">H</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">D</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C.includeEnd</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">J</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">&lt;</span><span class="NAME">x.numOfRoutepoints</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">x.routepoints</span><span class="PUNC">[</span><span class="NAME">x.numOfRoutepoints</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C.source.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"W"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">Number.MAX_VALUE</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">&lt;</span><span class="NAME">x.numOfWaypoints</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">==</span><span class="NAME">F</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">x.waypoints</span><span class="PUNC">[</span><span class="NAME">I</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">I</span><span class="PUNC">;</span><span class="NAME">H</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C.includeEnd</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">J</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">&lt;</span><span class="NAME">x.numOfWaypoints</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">x.waypoints</span><span class="PUNC">[</span><span class="NAME">x.numOfWaypoints</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">&lt;</span><span class="NAME">x.numOfTrackpoints</span><span class="PUNC">;</span><span class="NAME">I</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">x.pointAt</span><span class="PUNC">(</span><span class="NAME">I</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">B.dist</span><span class="PUNC">>=</span><span class="NAME">F</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">B</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">H</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">C.includeEnd</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.push</span><span class="PUNC">(</span><span class="NAME">x.pointAt</span><span class="PUNC">(</span><span class="NAME">x.numOfTrackpoints</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">y</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="STRN">"#totdist#totdist3d#minelev#maxelev#elevgain#elevloss#maxvel#avgvel#tottime#tottimestop#tottimeup#tottimedown#tottimeflat#totTimeMove#minheartrate#maxheartrate#avgheartrate#"</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NAME">z.container.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"th"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">&lt;</span><span class="NAME">D.length</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">A.search</span><span class="PUNC">(</span><span class="STRN">"#"</span><span class="PUNC">+</span><span class="NAME">D</span><span class="PUNC">[</span><span class="NAME">C</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">true</span><span class="PUNC">;</span><span class="KEYW">break</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">C</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">&lt;</span><span class="NAME">t.length</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">u.push</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Summary</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">,</span><span class="NAME">z.options</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="NAME">u</span><span class="PUNC">[</span><span class="NAME">C</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">options.source</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">G</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">==</span><span class="STRN">"rte"</span><span class="PUNC">?</span><span class="NAME">B</span><span class="PUNC">:</span><span class="NAME">x.indexOf</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">B</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">dist</span><span class="PUNC">,</span><span class="STRN">"dist"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">==</span><span class="STRN">"rte"</span><span class="PUNC">?</span><span class="NAME">C</span><span class="PUNC">:</span><span class="NAME">x.indexOf</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">C</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">dist</span><span class="PUNC">,</span><span class="STRN">"dist"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">u</span><span class="PUNC">[</span><span class="NAME">C</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">calculate</span><span class="PUNC">(</span><span class="NAME">G</span><span class="PUNC">,</span><span class="NAME">F</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">C</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">I</span><span class="PUNC">=</span><span class="NAME">this.container</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">I.backup</span><span class="PUNC">===</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">I.backup</span><span class="PUNC">=</span><span class="NAME">I.tBodies</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">cloneNode</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">I.removeChild</span><span class="PUNC">(</span><span class="NAME">I.tBodies</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">I.appendChild</span><span class="PUNC">(</span><span class="NAME">I.backup.cloneNode</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">J</span><span class="PUNC">=</span><span class="NAME">I.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"th"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">L</span><span class="PUNC">=</span><span class="NAME">I.tBodies</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">F</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">E</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">N</span><span class="PUNC">=</span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"tr"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">&lt;</span><span class="NAME">J.length</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">F.push</span><span class="PUNC">(</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">E</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">B</span><span class="PUNC">=</span><span class="NAME">this.options.decimals</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Q</span><span class="PUNC">=</span><span class="NAME">I.tBodies</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">rows</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">H</span><span class="PUNC">=</span><span class="NAME">Q.length</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">C</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">&lt;</span><span class="NAME">t.length</span><span class="PUNC">;</span><span class="NAME">E</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">M</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">E</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">P</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">&lt;</span><span class="NAME">Q.length</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">Q</span><span class="PUNC">[</span><span class="NAME">E</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">L.appendChild</span><span class="PUNC">(</span><span class="NAME">N</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">O</span><span class="PUNC">=</span><span class="NAME">P.cells</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">D</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">D</span><span class="PUNC">&lt;</span><span class="NAME">J.length</span><span class="PUNC">;</span><span class="NAME">D</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">O.length</span><span class="PUNC">&lt;</span><span class="NAME">J.length</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">P.insertCell</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">K</span><span class="PUNC">=</span><span class="NAME">F</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">A</span><span class="PUNC">=</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">==</span><span class="STRN">"num"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">E</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">M</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">M</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">G</span><span class="PUNC">=</span><span class="NAME">u</span><span class="PUNC">[</span><span class="NAME">E</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">G</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">G</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">===</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="PUNC">:</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">;</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="PUNC">=</span><span class="STRN">""</span><span class="PUNC">;</span><span class="NAME">A</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">this.options.factors</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">A</span><span class="PUNC">*</span><span class="NAME">this.options.factors</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">:</span><span class="NAME">A</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">!==</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">==</span><span class="STRN">"hour"</span><span class="PUNC">||</span><span class="NAME">K.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NUMB">7</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"totTime"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">r</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">K</span><span class="PUNC">==</span><span class="STRN">"time"</span><span class="PUNC">)</span><span class="PUNC">&&</span><span class="PUNC">(</span><span class="NAME">A.format</span><span class="PUNC">!==</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">A.format</span><span class="PUNC">(</span><span class="NAME">i.dateTimeFormat</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">A</span><span class="PUNC">=</span><span class="NAME">m</span><span class="PUNC">(</span><span class="NAME">A</span><span class="PUNC">,</span><span class="NAME">B</span><span class="PUNC">[</span><span class="NAME">K</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="NAME">O</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="PUNC">=</span><span class="NAME">A</span><span class="PUNC">+</span><span class="NAME">J</span><span class="PUNC">[</span><span class="NAME">D</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">units</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">E</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">>=</span><span class="NAME">H</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">N</span><span class="PUNC">=</span><span class="NAME">L.rows</span><span class="PUNC">[</span><span class="NAME">C</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">cloneNode</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">C</span><span class="PUNC">++</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">u</span><span class="PUNC">=</span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">=</span><span class="KEYW">false</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.loadData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.Button</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">,</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container</span><span class="PUNC">=</span><span class="NAME">Element.extend</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">values</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">""</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">onClick</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">tag</span><span class="PUNC">:</span><span class="STRN">""</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">,</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">&lt;</span><span class="NAME">z.values.length</span><span class="PUNC">;</span><span class="NAME">x</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">z</span><span class="PUNC">[</span><span class="STRN">"tag"</span><span class="PUNC">+</span><span class="NAME">z.values</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="NAME">z</span><span class="PUNC">[</span><span class="STRN">"tag"</span><span class="PUNC">+</span><span class="NAME">z.values</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">||</span><span class="NAME">i</span><span class="PUNC">[</span><span class="STRN">"tagbutton"</span><span class="PUNC">+</span><span class="NAME">this.container.className</span><span class="PUNC">+</span><span class="NAME">z.values</span><span class="PUNC">[</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOn</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w.container.src</span><span class="PUNC">=</span><span class="NAME">w.container.src.replace</span><span class="PUNC">(</span><span class="REGX">/_off(\..*)*/</span><span class="PUNC">,</span><span class="STRN">"_on$1"</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOff</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w.options.values</span><span class="PUNC">[</span><span class="NAME">v</span><span class="PUNC">]</span><span class="PUNC">!==</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w.container.src</span><span class="PUNC">=</span><span class="NAME">w.container.src.replace</span><span class="PUNC">(</span><span class="REGX">/_on(\..*)*/</span><span class="PUNC">,</span><span class="STRN">"_off$1"</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.getActiveValue</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.options.values</span><span class="PUNC">[</span><span class="NAME">v</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.getNextValue</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.options.values</span><span class="PUNC">[</span><span class="NAME">t</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container.title</span><span class="PUNC">=</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="STRN">"tag"</span><span class="PUNC">+</span><span class="NAME">this.options.values</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">this.container.alt</span><span class="PUNC">=</span><span class="NAME">this.container.title</span><span class="PUNC">;</span><span class="NAME">this.container.observe</span><span class="PUNC">(</span><span class="STRN">"click"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">y</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w.options.onClick</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">z</span><span class="PUNC">=</span><span class="NAME">w.getActiveValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">w.getNextValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w.options.values.length</span><span class="PUNC">></span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">j</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"boolean"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">w</span><span class="PUNC">[</span><span class="STRN">"set"</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">?</span><span class="STRN">"Off"</span><span class="PUNC">:</span><span class="STRN">"On"</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">w.container.src</span><span class="PUNC">=</span><span class="NAME">w.container.src.replace</span><span class="PUNC">(</span><span class="NAME">z</span><span class="PUNC">+</span><span class="STRN">"_"</span><span class="PUNC">,</span><span class="NAME">x</span><span class="PUNC">+</span><span class="STRN">"_"</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">v</span><span class="PUNC">=</span><span class="NAME">t</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">w.container.title</span><span class="PUNC">=</span><span class="NAME">w.options</span><span class="PUNC">[</span><span class="STRN">"tag"</span><span class="PUNC">+</span><span class="NAME">x</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="NAME">w.container.alt</span><span class="PUNC">=</span><span class="NAME">w.container.title</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="KEYW">this</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">==</span><span class="NAME">w.options.values.length</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NUMB">0</span><span class="PUNC">:</span><span class="NAME">v</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.container.observe</span><span class="PUNC">(</span><span class="STRN">"mouseover"</span><span class="PUNC">,</span><span class="NAME">this.setOn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.container.observe</span><span class="PUNC">(</span><span class="STRN">"mouseout"</span><span class="PUNC">,</span><span class="NAME">this.setOff</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">l.ButtonBar</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">,</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.container</span><span class="PUNC">=</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">u</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">this.options</span><span class="PUNC">=</span><span class="PUNC">{</span><span class="NAME">zoom</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">values</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="KEYW">true</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">onClick</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.setOptions</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">zoomEnabled</span><span class="PUNC">:</span><span class="PUNC">!</span><span class="NAME">w.getActiveValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">w.getActiveValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">&&</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">s.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="NAME">t.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">xaxis</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">values</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">"dist"</span><span class="PUNC">,</span><span class="STRN">"hour"</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">onClick</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.setOptions</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">x</span><span class="PUNC">:</span><span class="NAME">w.getNextValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.loadData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">yaxis</span><span class="PUNC">:</span><span class="PUNC">{</span><span class="NAME">values</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="STRN">"elev"</span><span class="PUNC">,</span><span class="STRN">"vel"</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">onClick</span><span class="PUNC">:</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">t.setOptions</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">y</span><span class="PUNC">:</span><span class="NAME">w.getNextValue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.loadData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="NAME">t.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NAME">chart</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">report</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">d</span><span class="PUNC">(</span><span class="NAME">w</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">=</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">x</span><span class="PUNC">=</span><span class="NAME">this.container.getElementsByTagName</span><span class="PUNC">(</span><span class="STRN">"img"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">w</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">w</span><span class="PUNC">&lt;</span><span class="NAME">x.length</span><span class="PUNC">;</span><span class="NAME">w</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">y</span><span class="PUNC">=</span><span class="NAME">x</span><span class="PUNC">[</span><span class="NAME">w</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="PUNC">;</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">l.Button</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">l.Button</span><span class="PUNC">(</span><span class="NAME">x</span><span class="PUNC">[</span><span class="NAME">w</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">this.options</span><span class="PUNC">[</span><span class="NAME">y</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="NAME">this.setOptions</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">=</span><span class="NAME">this.options.chart</span><span class="PUNC">,</span><span class="NAME">s</span><span class="PUNC">=</span><span class="NAME">this.options.report</span><span class="PUNC">;</span><span class="NAME">this.draw</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>